package com.lovo.homework7_18IOStream;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class CopyTest {
    public void copy(){
        FileInputStream fr =null;
        FileOutputStream fos = null;
        try {
            fr=new FileInputStream("e:/d.jpg");
            fos=new FileOutputStream("e:/e.jpg");
            int d=0;
            while ((d=fr.read())!=-1){
                fos.write((char)d);
            }
        }catch (FileNotFoundException e){
            e.printStackTrace();
        }catch (IOException e){
            e.printStackTrace();
        }finally {
            if (fr!=null){
                try {
                    fr.close();
                }catch (IOException e){
                    e.printStackTrace();
                }
            }
        }
    }
    public static void main(String[] args) {
        CopyTest copyTest = new CopyTest();
        copyTest.copy();
    }
}
